﻿@using LibraryHub.Core.Models.User
@model UserModel

@{
    ViewBag.Title = "Создание нового читателя";
}

<h2>@ViewBag.Title</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Читатель</legend>

        @Html.Hidden("Role", UserRoleEnum.Reader) @*TODO: Q: what is  the best way to set this? I was unable to use HiddenFor*@

        <div class="editor-label">
            @Html.LabelFor(model => model.Login, "Логин")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Login)
            @Html.ValidationMessageFor(model => model.Login)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Password, "Пароль")
        </div>
        <div class="editor-field">
            @Html.PasswordFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.FullName, "Полное имя")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FullName)
            @Html.ValidationMessageFor(model => model.FullName)
        </div>

        <p>
            <input type="submit" value="Создать читателя" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Вернуться к списку читателей", "Index")
</div>
